<!DOCTYPE html>
<html><head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Dorb Webapp</title>
	
	<link type="text/css" rel="stylesheet" href="index_files/css-reset.css">
	<link type="text/css" rel="stylesheet" href="index_files/main.css">
	<link type="text/css" rel="stylesheet" href="index_files/menu.css">
	<link type="text/css" rel="stylesheet" href="index_files/forms.css">
	<link type="text/css" rel="stylesheet" href="index_files/modal.css">
	<link type="text/css" rel="stylesheet" href="index_files/jquery-ui-1.css">
	
	<link rel="shortcut icon" type="image/x-icon" href="http://localhost/favicon.ico">
	
	<script type="text/javascript" src="index_files/jquery-1.js"></script>
	<script type="text/javascript" src="index_files/jquery-ui-1.js"></script>
	<script type="text/javascript" src="index_files/forms.js"></script>
	<script type="text/javascript" src="index_files/jquery.js"></script>
	<script type="text/javascript" src="index_files/picnet.js"></script>
	<script type="text/javascript" src="index_files/dorb.js"></script>
	
</head>
<body>

		<div id="menu">
			<a href="http://localhost/home"><h6 id="appname">Dorb</h6></a>
			<a href="http://localhost/mijn-gegevens" class="userinfo group" title="administrator@dorb.com">
			
			<img src="index_files/1.png" class="userlogo"> 
				<div class="usertext">
					<h2 id="username">administrator@dorb.com</h2> 
					<span id="userroles">SysOp</span>
				</div>
			</a>


		
			<ul id="derpmenu">
				<li><a href="/mijn-gegevens">Mijn gegevens</a></li>
				<li><a href="/mobile/">Overzicht Orders Touch</a></li>
				<li><a href="/feedbackcentrum">Feedbackcentrum</a></li>
				<li><a href="/uitloggen">Uitloggen</a></li>
			</ul>
			
		</div><div id="content-container">
	<div class="content">
	
	

		<table id="theTable">
		</table>
		
	</div>
</div>

<div id="modal-container">
	<div id="modal">
		<div class="closemodal">
			<img src="index_files/close.png">
		</div>
		<form autocomplete="off" method="post" enctype="multipart/form-data" class="generiek-form" id="derp">
		<input name="formid" value="statusWijzig" method="post" type="hidden">
		<input value="" name="actie" type="hidden">
		<input value="" name="vracht" type="hidden">		
		
		<div class="thumbbutton" data-action="opgehaald">
			<img src="index_files/loaded.png">
			<span>Opgehaald</span>
		</div>
		<div class="thumbbutton" data-action="afgeleverd">
			<img src="index_files/unloaded.png">
			<span>Afgeleverd</span>
		</div>
		<div class="thumbbutton" data-action="vertraging">
			<img src="index_files/vertraging.png">
			<span>Vertraging melden</span>
		</div>
		
	</form>	
	</div>
</div>



<script>

$el = $('#theTable');

$el.on('click','tr[data-vracht]',function(){
	$('#modal-container').show();
	$('[name=vracht]').val($(this).data('vracht'));
});


$('.thumbbutton').click(function() {
	$('[name=actie]').val($(this).data('action'));
	//$(this).parents('form').submit();
	
	//console.log($('#derp').serialize());
	
	$.getJSON('derplogistics.php', $('#derp').serialize(), function(data)
	{
		if (data.status!='success')
		{
		
			alert('Derp! Er is iets fout gegaan. ' + data.status);
			
		}
		else
		{
			reloadAll();
		}
	
	});
	$('#modal-container').hide();
});

$('.closemodal img').click(function() {
	$('#modal-container').hide();
});

var deata;

function reloadAll()
{


	$.getJSON('cool.php',function(userdata) {

		awa = userdata;
		
		$el.html('');

		$('.userlogo').attr('src','/logos/' + userdata.user.bedrijf + '.png');
		$('#username').html(userdata.user.email);
		$('#userroles').html(userdata.rollen.join('; '));

		if (userdata.user.email)
		{
		
			$.getJSON('jason.php',function(data){
			
				deata = data;
				
				for (var rit in data)
				{
					$el.append('<thead>\
						<tr>\
							<th colspan="7">\
								<div class="group">\
									<div class="left" style="width:auto;">\
										<div class="truck">' + data[rit][0].vrachtwagen + '</div>\
										<div class="trailer">' + data[rit][0].oplegger + '</div>\
										<div class="date">' + data[rit][0].datum + '</div>\
									</div>\
									<div class="left ritnrinfo" style="width:auto;">\
										Rit ' + data[rit][0].rit + '						</div>\
								</div>\
							</th>\
						</tr>\
						<tr>\
							<th>Vracht</th>	\
							<th>Status</th>\
							<th>Van</th>\
							<th>Naar</th>\
							<th>Afhaal</th>\
							<th>Aflever</th>\
							<th># pallets</th>\
						</tr>\
						</thead>');
						
					$tbody = $('<tbody></tbody>');
					
				
					
					for (var vr8 in data[rit])
					{
					
						
						if (vr8!=null)
						{
							$tbody.append('\
							<tr data-vracht="'+data[rit][vr8].vracht+'">\
								<td>'+data[rit][vr8].vracht+'</td>\
								<td>'+(data[rit][vr8].status||'ingepland')+'</td>\
								<td>'+data[rit][vr8].naar+'</td>\
								<td>'+data[rit][vr8].van+'</td>\
								<td>'+data[rit][vr8].afhaalmoment+'</td>\
								<td>'+data[rit][vr8].aflevermoment+'</td>\
								<td>'+data[rit][vr8].pallets+'</td>\
							</tr>\
							');
						}
					}
					
					$tbody.appendTo($el);
					
				}

			});
		}
		else
		{
			// show modal van inloggen
			window.location='/';
		}
	});

}

reloadAll();

</script>


<!-- Exec time: 0.035783052444458 sec -->
		


</body></html>